package com.ssm.controller;


import com.ssm.service.MoneyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/money")
public class MoneyController {

    @Autowired
    MoneyService moneyService;

    //进入到转账页面
    @RequestMapping("/transformPage")
    public String intoTransformPage(){
        return "transferAccounts";
    }


    @RequestMapping(value = "/transformAccounts",produces="text/html;charset=UTF-8")
    @ResponseBody
    public String transferAccounts(String outId,String inId,String money){
        //调用转账方法，获取转账结果
        String backInfo = moneyService.transformAccounts(
            Integer.parseInt(outId),
            Integer.parseInt(inId),
            Integer.parseInt(money)
        );

        return backInfo;
    }


}
